<template>
  <div id="receiptManageadd">
    <div style="margin-bottom:40px ;">
      <div class="paymentReqAdd_head">
        <div>
          <div class="rule_title">
            <span class="title-l">
              <i class="icon_left"></i>{{ titleTip }}
              <span
                v-if="paramsData.Type == 2"
                style="margin: 0px 0px 0px 20px; color: #f1a357"
                >{{ formdata.status_name }}</span
              >
            </span>
          </div>
        </div>
        <div
          class="receiptManageadd_form"
          v-if="paramsData.Type == 0 || paramsData.Type == 1"
        >
          <el-form
            label-width="180px"
            :model="formdata"
            ref="ruleForm"
            :rules="rulesdata"
            :disabled="disabledType"
          >
            <el-row style="display: flex; flex-wrap: wrap">
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1 && paramsData.Type == 2"
              >
                <el-form-item label="开票主体" prop="company_invoice_body_id">
                  <el-select
                    style="width: 82%"
                    filterable
                    v-model="formdata.company_invoice_body_id"
                  >
                    <el-option
                      v-for="item in company_invoice_book_list"
                      :key="item.id"
                      :label="item.invoice_body_name"
                      :value="item.id + ''"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1 && paramsData.Type == 2"
              >
                <el-form-item label="发票类型" prop="invoice_type">
                  <el-select
                    clearable
                    style="width: 100%"
                    placeholder="请选择发票类型"
                    v-model="formdata.invoice_type"
                  >
                    <el-option label="专用发票" value="1"></el-option>
                    <el-option label="普通发票" value="2"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type == 2">
                <el-form-item label="对账单号" prop="apply_no">
                  <span
                    style="color: blue; cursor: pointer"
                    @click="StatementNumber()"
                    >{{ formdata.apply_no }}</span
                  >
                  <span
                    style="
                      color: blue;
                      cursor: pointer;
                      margin: 0px 0px 0px 10px;
                    "
                    @click="diagnose()"
                    >诊断</span
                  >
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户名称" prop="customer_id_name">
                  <span>{{ formdata.customer_id_name }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="开票抬头" prop="customer_invoice_body_id">
                  <td>
                    <el-select
                      allow-create
                      filterable
                      clearable
                      reserve-keyword
                      placeholder="请输入开票抬头"
                      v-model="formdata.customer_invoice_body_id"
                      @change="selectedWebsite"
                    >
                      <el-option
                        v-for="item in customer_invoice_book_list"
                        :key="item.id"
                        :label="item.invoice_body_name"
                        :value="item.id + ''"
                      ></el-option>
                    </el-select>
                  </td>
                  <td>
                    <el-button class="add-right" @click="AddInvoice(1)"
                      >+</el-button
                    >
                  </td>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type == 1 || paramsData.Type == 0"
              >
                <el-form-item label="对账单号" prop="apply_no">
                  <span
                    style="color: blue; cursor: pointer"
                    @click="StatementNumber()"
                    >{{ formdata.apply_no }}</span
                  >
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="纳税人识别号">
                  <el-input
                    autosize
                    v-model="
                      formdata.customer_invoice_book_info
                        .taxpayer_identify_number
                    "
                    disabled
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="公司地址">
                  <el-input
                    autosize
                    v-model="
                      formdata.customer_invoice_book_info.company_address
                    "
                    disabled
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="公司电话">
                  <el-input
                    autosize
                    v-model="formdata.customer_invoice_book_info.company_phone"
                    disabled
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="开户行">
                  <el-input
                    autosize
                    v-model="
                      formdata.customer_invoice_book_info.bank_of_deposit
                    "
                    disabled
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="开户行账户">
                  <el-input
                    autosize
                    v-model="formdata.customer_invoice_book_info.account_no"
                    disabled
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="是否开具发票" prop="is_invoiced">
                  <el-select
                    v-model="formdata.is_invoiced"
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in OpeningInvoice"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <div style="width: 33.3%;"
                v-if="
                  formdata.is_invoiced == 1 &&
                  (paramsData.Type == 1 || paramsData.Type == 0)
                "
              >
                <el-form-item label="发票类型" prop="invoice_type">
                  <el-select
                    clearable
                    style="width: 100%"
                    placeholder="请选择发票类型"
                    v-model="formdata.invoice_type"
                  >
                    <el-option label="专用发票" value="1"></el-option>
                    <el-option label="普通发票" value="2"></el-option>
                  </el-select>
                </el-form-item>
              </div>
              <el-col :span="8">
                <el-form-item label="发票金额">
                  <el-input autosize v-model="formdata.invoice_amount" disabled>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type == 2">
                <el-form-item label="调账前总金额">
                  <span>{{ formdata.customer_account_old_price }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type == 2">
                <el-form-item label="调账差额">
                  <span
                    @click="AdjustmentBalance()"
                    style="color: #0000FF; cursor: pointer"
                    >{{ formdata.customer_account_diff_price }}</span
                  >
                </el-form-item>
              </el-col>
              <div style="width: 33.3%;"
                v-if="
                  formdata.is_invoiced == 1 &&
                  (paramsData.Type == 1 || paramsData.Type == 0)
                "
              >
                <!-- 这个是 -->
                <el-form-item label="开票主体" prop="company_invoice_body_id">
                  <el-select
                    style="width: 82%"
                    filterable
                    v-model="formdata.company_invoice_body_id"
                  >
                    <el-option
                      v-for="item in company_invoice_book_list"
                      :key="item.id"
                      :label="item.invoice_body_name"
                      :value="item.id + ''"
                    ></el-option>
                  </el-select>
                  <!-- <el-button class="add-right" @click="AddInvoice(0)">+</el-button> -->
                </el-form-item>
              </div>
              <div style="width: 33.3%;" v-if="formdata.is_invoiced == 1">
                <el-form-item label="发票类目" prop="invoice_category">
                  <el-select
                    @change="selectCategory"
                    style="width: 100%"
                    v-model="formdata.invoice_category"
                    placeholder="请选择发票类目"
                  >
                    <el-option label="运输服务*运输费" value="1"></el-option>
                    <el-option
                      label="运输服务*物流辅助服务"
                      value="2"
                    ></el-option>
                    <el-option
                      label="经纪代理服务*国内货物运输代理服务"
                      value="3"
                    ></el-option>
                    <el-option label="技术服务费" value="4"></el-option>
                    <el-option
                      label="物流辅助服务*仓储费"
                      value="5"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </div>
              <el-col :span="8" v-if="formdata.is_invoiced == 1">
                <el-form-item label="发票税率" prop="apply_reason">
                  <span style="margin-left: 20px"
                    >{{ formdata.invoice_rate }}%</span
                  >
                </el-form-item>
              </el-col>

              <el-col :span="8" v-if="formdata.is_invoiced == 1">
                <el-form-item
                  label="运输货物"
                  prop="transport_goods"
                  :required="formdata.invoice_rate == 9"
                >
                  <el-input autosize v-model="formdata.transport_goods">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="formdata.is_invoiced == 1">
                <el-form-item
                  label="运输车牌号"
                  prop="vehicle_number"
                  :required="formdata.invoice_rate == 9"
                >
                  <el-input autosize v-model="formdata.vehicle_number">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="formdata.is_invoiced == 1">
                <el-form-item
                  label="车辆型号"
                  prop="vehicle_type"
                  :required="formdata.invoice_rate == 9"
                >
                  <el-input autosize v-model="formdata.vehicle_type">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                style="display: flex"
              >
                <!-- <el-form-item label="起止地" prop="start_stop_place"
                                    :required="formdata.invoice_rate == 9">
                                    <el-input autosize v-model="formdata.start_stop_place">
                                    </el-input>
                                </el-form-item> -->
                <el-form-item
                  label="起止地"
                  prop="start_place"
                  :required="formdata.invoice_rate == 9"
                >
                  <el-input
                    autosize
                    v-model="formdata.start_place"
                    placeholder="始发地/北京"
                  >
                  </el-input> </el-form-item
                ><span>-</span>
                <el-form-item label="" prop="end_place" label-width="0px">
                  <el-input
                    autosize
                    v-model="formdata.end_place"
                    placeholder="目的地/北京"
                  ></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="预计回款时间" prop="return_time">
                  <el-date-picker
                    v-model="formdata.return_time"
                    type="datetime"
                    align="right"
                    value-format="timestamp"
                    unlink-panels
                    style="width: 100%"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type != 0">
                <el-form-item label="账单日期" prop="statement_date">
                  <span>{{ formdata.statement_date }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type != 0">
                <el-form-item label="业务类型" prop="business_type">
                  <el-select
                    v-model="formdata.business_type"
                    multiple
                    filterable
                    allow-create
                    default-first-option
                    placeholder="业务类型"
                  >
                    <el-option
                      v-for="item in businessType"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="收入部门" prop="revenue_branch_id">
                  <el-select
                    style="width: 82%"
                    filterable
                    v-model="formdata.revenue_branch_id"
                  >
                    <el-option
                      v-for="item in RevenueSector"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id + ''"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <!-- <el-col :span="8">
                                <el-form-item label="对账单需要盖章邮寄" prop="is_need_send">
                                    <el-select style="width: 100%" placeholder="对账单需要盖章邮寄"
                                        v-model="formdata.is_need_send">
                                        <el-option label="否" value="0"></el-option>
                                        <el-option label="是" value="1"></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8" v-if="formdata.is_need_send == 1 ">
                                <el-form-item label="对账单邮寄地址" prop="apply_reason">
                                    <el-input autosize v-model="formdata.mailing_address">
                                    </el-input>
                                </el-form-item>
                            </el-col> -->
              <el-col :span="8">
                <el-form-item label="备注" prop="apply_reason">
                  <el-input autosize v-model="formdata.remark"> </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="附件" prop="apply_reason">
                  <UploadLink :files.sync="formdata.annex"></UploadLink>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type == 2">
                <el-form-item label="申请人">
                  <span>{{ formdata.creator_id_name }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" v-if="paramsData.Type == 2">
                <el-form-item label="申请时间">
                  <span v-time="formdata.create_time"></span>
                </el-form-item>
              </el-col>
              <!-- <el-col :span="8" v-if="paramsData.Type == 2">
                                <el-form-item label="审批状态">
                                    <span>{{formdata.status_name}}</span>
                                </el-form-item>
                            </el-col> -->
            </el-row>
          </el-form>
        </div>
        <div class="receiptManageadd_form receiptManageadd_form_details" v-else>
          <el-form
            label-width="180px"
            :model="formdata"
            ref="ruleForm"
            :rules="rulesdata"
            label-position="top"
            :disabled="disabledType"
          >
            <el-row style="display: flex; flex-wrap: wrap">
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1 && paramsData.Type == 2"
                class="row_height_of"
              >
                <el-form-item label="开票主体" prop="company_invoice_body_id">
                  <span v-if="formdata.company_invoice_body_id_info != null">{{
                    formdata.company_invoice_body_id_info.invoice_body_name
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1 && paramsData.Type == 2"
                class="row_height_of"
              >
                <el-form-item label="发票类型" prop="invoice_type">
                  <span>{{ formdata.invoice_type_name }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type == 2"
                class="row_height_of"
              >
                <el-form-item label="对账单号" prop="apply_no">
                  <span
                    style="color: blue; cursor: pointer"
                    @click="StatementNumber()"
                    >{{ formdata.apply_no }}</span
                  >
                  <span
                    style="
                      color: blue;
                      cursor: pointer;
                      margin: 0px 0px 0px 10px;
                    "
                    @click="diagnose()"
                    >诊断</span
                  >
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="客户名称" prop="customer_id_name">
                  <span>{{ formdata.customer_id_name }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="开票抬头" prop="customer_invoice_body_id">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info.invoice_body_name
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="纳税人识别号">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info
                      .taxpayer_identify_number
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="公司地址">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info.company_address
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="公司电话">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info.company_phone
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="开户行">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info.bank_of_deposit
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="开户行账户">
                  <span v-if="formdata.customer_invoice_body_id_info != null">{{
                    formdata.customer_invoice_body_id_info.account_no
                  }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="是否开具发票" prop="is_invoiced">
                  <span>{{ formdata.is_invoiced_name }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="发票金额">
                  <span>{{ formdata.invoice_amount }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="调账前总金额">
                  <!-- <el-input v-model="formdata.payment_amount" disabled></el-input> -->
                  <span>{{ formdata.customer_account_old_price }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="调账差额">
                  <!-- <el-input v-model="formdata.payment_amount" disabled></el-input> -->
                  <span
                    @click="AdjustmentBalance()"
                    style="color: #0000FF; cursor: pointer"
                    >{{ formdata.customer_account_diff_price }}</span
                  >
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item label="发票类目" prop="invoice_category">
                  <span>{{ formdata.invoice_category_name }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item label="发票税率" prop="apply_reason">
                  <span 
                    >{{ formdata.invoice_rate }}%</span
                  >
                </el-form-item>
              </el-col>

              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item
                  label="运输货物"
                  prop="transport_goods"
                  :required="formdata.invoice_rate == 9"
                >
                  <span>{{ formdata.transport_goods }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item
                  label="运输车牌号"
                  prop="vehicle_number"
                  :required="formdata.invoice_rate == 9"
                >
                  <span>{{ formdata.vehicle_number }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item
                  label="车辆型号"
                  prop="vehicle_type"
                  :required="formdata.invoice_rate == 9"
                >
                  <span>{{ formdata.vehicle_type }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="formdata.is_invoiced == 1"
                class="row_height_of"
              >
                <el-form-item
                  label="起止地"
                  prop="start_stop_place"
                  :required="formdata.invoice_rate == 9"
                >
                  <!-- <span>{{formdata.start_stop_place}}</span> -->
                  <span>{{ formdata.start_place }}</span> -
                  <span>{{ formdata.end_place }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="预计回款时间" prop="return_time">
                  <span v-time="formdata.return_time"></span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type != 0"
                class="row_height_of"
              >
                <el-form-item label="账单日期" prop="statement_date">
                  <span>{{ formdata.statement_date }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type != 0"
                class="row_height_of"
              >
                <el-form-item label="业务类型" prop="business_type">
                  <span
                    v-for="(item, index) in formdata.business_type"
                    :key="index"
                  >
                    <span style="margin: 0px 10px 0px 0px">{{ item }}</span>
                  </span>
                </el-form-item>
              </el-col>
              <el-col :span="8" class="row_height_of">
                <el-form-item label="收入部门" prop="revenue_branch_id">
                  <span>{{ formdata.revenue_branch_id_name }}</span>
                </el-form-item>
              </el-col>
              <!-- <el-col :span="8">
                                <el-form-item label="对账单需要盖章邮寄" prop="is_need_send">
                                    <el-select style="width: 100%" placeholder="对账单需要盖章邮寄"
                                        v-model="formdata.is_need_send">
                                        <el-option label="否" value="0"></el-option>
                                        <el-option label="是" value="1"></el-option>
                                    </el-select>
                                </el-form-item>
                            </el-col>
                            <el-col :span="8" v-if="formdata.is_need_send == 1 ">
                                <el-form-item label="对账单邮寄地址" prop="apply_reason">
                                    <el-input autosize v-model="formdata.mailing_address">
                                    </el-input>
                                </el-form-item>
                            </el-col> -->
              <el-col :span="8" class="row_height_of">
                <el-form-item label="备注" prop="apply_reason">
                  <el-input
                    type="textarea"
                    autosize
                    style="width: 80%"
                    v-model="formdata.remark"
                  >
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type == 2"
                class="row_height_of"
              >
                <el-form-item label="申请人">
                  <span>{{ formdata.creator_id_name }}</span>
                </el-form-item>
              </el-col>
              <el-col
                :span="8"
                v-if="paramsData.Type == 2"
                class="row_height_of"
              >
                <el-form-item label="申请时间">
                  <span v-time="formdata.create_time"></span>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="附件" prop="apply_reason">
                  <UploadLink :files.sync="formdata.annex"></UploadLink>
                </el-form-item>
              </el-col>

              <!-- <el-col :span="8" v-if="paramsData.Type == 2">
                                <el-form-item label="审批状态">
                                    <span>{{formdata.status_name}}</span>
                                </el-form-item>
                            </el-col> -->
            </el-row>
          </el-form>
        </div>
      </div>
      <!-- 客户发票主体 -->
      <div class="dialog">
        <el-dialog
          title="创建发票主体"
          :visible.sync="dialogVisible"
          width="50%"
        >
          <el-form
            :model="formList"
            label-width="140px"
            ref="formList"
            :rules="formrules"
          >
            <el-form-item label="发票主体名称:" prop="invoice_body_name">
              <el-input
                v-model="formList.invoice_body_name"
                placeholder="请输入发票主体名称"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item label="纳税人识别号:" prop="taxpayer_identify_number">
              <el-input
                v-model="formList.taxpayer_identify_number"
                placeholder="请输入纳税人识别号"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item label="公司地址:" prop="company_address">
              <el-input
                v-model="formList.company_address"
                placeholder="请输入公司地址"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item label="公司电话:" prop="company_phone">
              <el-input
                v-model="formList.company_phone"
                placeholder="请输入公司电话"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item label="开户行:" prop="bank_of_deposit">
              <el-input
                v-model="formList.bank_of_deposit"
                placeholder="请输入开户行"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item label="开户行账号:" prop="account_no">
              <el-input
                v-model="formList.account_no"
                placeholder="请输入开户行账号"
                style="width: 410px"
              ></el-input>
            </el-form-item>
            <el-form-item
              label="关联渡石发票主体:"
              prop="relation_invoice_body_id"
            >
              <el-select
                v-model="formList.relation_invoice_body_id"
                placeholder="请选择关联渡石发票主体"
                filterable
                multiple
                style="width: 410px"
              >
                <el-option
                  v-for="item in formListoptions"
                  :key="item.id"
                  :label="item.invoice_body_name"
                  :value="item.id + ''"
                >
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button
                data-tracker="P58-4"
                type="primary"
                plain
                @click="dialogVisibleflase()"
                >取消</el-button
              >
              <el-button
                data-tracker="P58-4"
                type="primary"
                plain
                @click="establish('formList')"
                >保存</el-button
              >
            </el-form-item>
          </el-form>
        </el-dialog>
      </div>
      <!-- 审批 -->
      <!-- paramsData.TageType != 0 && -->
      <div
        class="auditProcess"
        v-if=" Object.keys(AuditDetails).length != 0"
      >
        <approval
          :AuditDetails="AuditDetails"
          :fatherMethod="fatherMethod"
          style="width: 100%"
          :key="Math.random()"
        ></approval>
      </div>
      <!-- 添加评论 -->
      <div class="commentdialog">
        <el-dialog
          title="添加评论"
          :visible.sync="commdialogVisible"
          width="30%"
        >
          <!-- <el-input :row="1" v-model="recordex.content" type="textarea"></el-input> -->
          <div>
            <!-- <div ref="editor"></div> -->
            <quillLink
              :AuditDetails="AuditDetails"
              ref="quilldata"
              @showCityName="updateCity"
            ></quillLink>
          </div>
          <div style="margin: 10px 0px 0px 0px; display: flex">
            <!-- <div style="margin: 6px 10px 0px 0px;">上传附件:</div> -->
            <UploadLink :files.sync="recordex.annex"></UploadLink>
          </div>
          <div slot="footer" class="dialog-footer" style="text-align: center">
            <el-button @click="commdialogVisible = false">关闭</el-button>
            <el-button type="primary" @click="preserveComment()"
              >确 定</el-button
            >
          </div>
        </el-dialog>
      </div>
      <!-- 催办  -->
      <div class="presstodo">
        <el-dialog title="选择催办人" :visible.sync="outerVisible">
          <div>
            <el-transfer
              v-model="outerVisibleList"
              :props="{
                key: 'id',
                label: 'name',
              }"
              :data="AuditDetails.urge_relation_user"
              :titles="['全选', '已选']"
            >
            </el-transfer>
          </div>
          <div slot="footer" class="dialog-footer">
            <el-button @click="outerVisible = false">取 消</el-button>
            <el-button type="primary" @click="outerVisibleconfirm()"
              >确定</el-button
            >
          </div>
        </el-dialog>
      </div>
      <!-- 审核意见 -->
      <div class="auditOpinion">
        <el-dialog
          title="审核意见"
          :visible.sync="auditOpinionVisble"
          width="30%"
        >
          <div style="margin-bottom: 10px">
            <el-input
              v-model="opinionFile.opinion"
              type="textarea"
              :rows="4"
            ></el-input>
          </div>
          <div class="uploadList">
            <el-upload
              action
              :auto-upload="false"
              list-type="picture-card"
              :on-change="handleChange"
              :file-list="fileListList"
            >
              <i class="el-icon-plus"></i>
            </el-upload>
          </div>
          <div slot="footer" class="dialog-footer" style="text-align: center">
            <el-button type="primary" @click="PassAuditcancel()"
              >关闭</el-button
            >
            <el-button
              @click="PassAudit()"
              v-if="PassAuditsucced == 1"
              type="primary"
              plain
              >审核通过</el-button
            >
            <el-button
              @click="ReviewAudit()"
              v-if="PassAuditsucced == 2"
              type="primary"
              plain
              >审核驳回</el-button
            >
          </div>
        </el-dialog>
      </div>
      <!--诊断  -->
      <div class="diagnosedata">
        <el-dialog title="诊断" :visible.sync="diagnosedatalog" width="80%">
          <!-- <div > -->
          <el-table
            :data="diagnoseListe"
            sum-text="汇总"
            show-summary
            :summary-method="getSummaries"
            fixed
            style="width: 100%"
            :height="tableHeight"
          >
            <el-table-column prop="waybill_no" label="运单号" width="150" fiexe>
              <template slot-scope="scope">
                <span
                  style="color: #409eff; cursor: pointer"
                  @click="wayClick(scope.row)"
                >
                  {{ scope.row.waybill_no }}
                </span>
              </template>
            </el-table-column>
            <el-table-column
              prop="customer_id_name"
              label="所属客户"
              width="150"
            >
            </el-table-column>
            <el-table-column
              prop="waybill_product_type_name"
              label="承运类型"
              width="100"
            >
            </el-table-column>
            <el-table-column
              prop="package_type_name"
              label="包装型号"
              width="100"
            >
            </el-table-column>
            <el-table-column prop="total_freight" label="总运费" width="80">
              <template slot-scope="scope">
                <span
                  style="color: #409eff; cursor: pointer"
                  @click="freightclick(scope.row, '总费用明细', 0)"
                >
                  {{ scope.row.total_freight }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="adjust_money" label="调账分摊金额" width="100">
              <template slot-scope="scope">
                <span
                  style="color: #44fb3d; cursor: pointer"
                  @click="AssessedAmount(scope.row, '调账分摊金额', 0)"
                >
                  {{ scope.row.adjust_money }}
                </span>
              </template>
            </el-table-column>
            <el-table-column prop="total_expense" label="总成本" width="80">
            </el-table-column>
            <el-table-column prop="gross_profit" label="毛利润" width="80">
              <template slot-scope="scope">
                <span v-if="scope.row.gross_profit * 1 < 0" style="color: red">
                  {{ scope.row.gross_profit }}
                </span>
                <span v-else> {{ scope.row.gross_profit }} </span>
              </template>
            </el-table-column>
            <el-table-column prop="gross_margin" label="毛利率" width="80">
              <template slot-scope="scope">
                <span
                  v-if="parseFloat(scope.row.gross_margin) < 0"
                  style="color: red"
                >
                  {{ scope.row.gross_margin }}
                </span>
                <span v-else> {{ scope.row.gross_margin }} </span>
              </template>
            </el-table-column>
            <el-table-column label="揽收" width="150" align="center">
              <el-table-column
                prop="collect_info.total_expense"
                label="总费用"
                width="80"
              >
                <template slot-scope="scope">
                  <span
                    style="color: #409eff; cursor: pointer"
                    @click="freightclick(scope.row, '揽收费用明细', 1)"
                  >
                    {{ scope.row.collect_info.total_expense }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column prop="collect_info.adjust_money" label="调账分摊金额" width="100">
                <template slot-scope="scope">
                  <span
                    style="color: #44fb3d; cursor: pointer"
                    @click="AssessedAmount(scope.row, '揽收调账分摊金额', 1)"
                  >
                    {{ scope.row.collect_info.adjust_money }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="collect_info.status"
                label="状态"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.collect_info.status_name }}</span>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="干线" width="150" align="center">
              <el-table-column
                prop="dispatch_info.total_expense"
                label="总费用"
                width="80"
              >
                <template slot-scope="scope">
                  <span
                    style="color: #409eff; cursor: pointer"
                    @click="freightclick(scope.row, '干线费用明细', 2)"
                  >
                    {{ scope.row.dispatch_info.total_expense }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column prop="dispatch_info.adjust_money" label="调账分摊金额" width="100">
                <template slot-scope="scope">
                  <span
                    style="color: #44fb3d; cursor: pointer"
                    @click="AssessedAmount(scope.row, '干线调账分摊金额', 2)"
                  >
                    {{ scope.row.dispatch_info.adjust_money }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="dispatch_info.status
                                "
                label="状态"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.dispatch_info.status_name  }}</span>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="配送" width="150" align="center">
              <el-table-column
                prop="distribution_info.total_expense"
                label="总费用"
                width="80"
              >
                <template slot-scope="scope">
                  <span
                    style="color: #409eff; cursor: pointer"
                    @click="freightclick(scope.row, '配送费用明细', 3)"
                  >
                    {{ scope.row.distribution_info.total_expense }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column prop="distribution_info.adjust_money" label="调账分摊金额" width="100">
                <template slot-scope="scope">
                  <span
                    style="color: #44fb3d; cursor: pointer"
                    @click="AssessedAmount(scope.row, '配送调账分摊金额', 3)"
                  >
                    {{ scope.row.distribution_info.adjust_money }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="distribution_info.status"
                label="状态"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{
                    scope.row.distribution_info.status_name
                  }}</span>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="回单" width="150" align="center">
              <el-table-column
                prop="receipt_info.total_expense"
                label="总费用"
                width="80"
              >
                <template slot-scope="scope">
                  <span
                    style="color: #409eff; cursor: pointer"
                    @click="freightclick(scope.row, '回单费用明细', 4)"
                  >
                    {{ scope.row.receipt_info.total_expense }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column prop="receipt_info.adjust_money" label="调账分摊金额" width="100">
                <template slot-scope="scope">
                  <span
                    style="color: #44fb3d; cursor: pointer"
                    @click="AssessedAmount(scope.row, '回单调账分摊金额', 4)"
                  >
                    {{ scope.row.receipt_info.adjust_money }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="receipt_info.status"
                label="状态"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.receipt_info.status_name  }}</span>
                </template>
              </el-table-column>
            </el-table-column>
            <el-table-column label="回箱" width="150" align="center">
              <el-table-column
                prop="box_recycle_info.total_expense"
                label="总费用"
                width="80"
              >
                <template slot-scope="scope">
                  <span
                    style="color: #409eff; cursor: pointer"
                    @click="freightclick(scope.row, '回箱费用明细', 5)"
                  >
                    {{ scope.row.box_recycle_info.total_expense }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column prop="box_recycle_info.adjust_money" label="调账分摊金额" width="100">
                <template slot-scope="scope">
                  <span
                    style="color: #44fb3d; cursor: pointer"
                    @click="AssessedAmount(scope.row, '回箱调账分摊金额', 5)"
                  >
                    {{ scope.row.box_recycle_info.adjust_money }}
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                prop="box_recycle_info.status"
                label="状态"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{
                    scope.row.box_recycle_info.status_name
                  }}</span>
                </template>
              </el-table-column>
            </el-table-column>
          </el-table>
          <!-- </div>
                    <div> -->
          <el-dialog
            width="60%"
            :title="innerText"
            :visible.sync="innerVisible"
            append-to-body
          >
            <div v-if="innerType == 0">
              <el-table :data="updatedData" style="width: 100%">
                <el-table-column prop="key_1" label="运费" width="180">
                </el-table-column>
                <el-table-column prop="key_4" label="送货费" width="180">
                </el-table-column>
                <el-table-column prop="key_5" label="提货费" width="180">
                </el-table-column>
                <el-table-column prop="key_6" label="装卸费" width="180">
                </el-table-column>
                <el-table-column prop="key_8" label="保价费" width="180">
                </el-table-column>
                <el-table-column prop="key_9" label="包装费" width="180">
                </el-table-column>
                <el-table-column prop="key_10" label="其他费用" width="180">
                </el-table-column>
                <el-table-column prop="adjust_reason" label="原因" width="180">
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerType == 1">
              <el-table :data="innerList" style="width: 100%">
                <el-table-column
                  prop="collect_money"
                  label="提货费"
                  width="180"
                >
                </el-table-column>
                <el-table-column
                  prop="delivery_money"
                  label="发货费"
                  width="180"
                >
                </el-table-column>
                <el-table-column prop="handling_money" label="装卸费">
                </el-table-column>
                <el-table-column prop="package_money" label="包装费">
                </el-table-column>
                <el-table-column
                prop="airport_pick_money"
                label="揽收机场提货费"
                width="180"
              >
              </el-table-column>
                <el-table-column
                prop="dry_ice_money"
                label="揽收干冰费"
                width="180"
              >
              </el-table-column>
              <el-table-column prop="adjust_reason" label="原因" width="180">
              </el-table-column>
              </el-table>
            </div>
            <div v-if="innerType == 2">
              <el-table :data="innerList" style="width: 100%">
                <el-table-column prop="expense" label="干线费" width="180">
                </el-table-column>
                <el-table-column prop="adjust_reason" label="原因" width="180">
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerType == 3">
              <el-table :data="innerList" style="width: 100%">
                <!-- <el-table-column prop="delivery_fee" label="发货费" width="180">
                </el-table-column>
                <el-table-column
                  prop="extra_distribution_fee"
                  label="超区配送费"
                  width="180"
                >
                </el-table-column>
                <el-table-column
                  prop="second_distribution_fee"
                  label="二次配送费"
                >
                </el-table-column>
                <el-table-column prop="waiting_fee" label="等待费">
                </el-table-column> -->
                <el-table-column prop="delivery_fee" label="配送费" width="180">
                </el-table-column>
                <el-table-column
                  prop="extra_distribution_fee"
                  label="配送里程费"
                  width="180"
                >
                </el-table-column>
                <el-table-column prop="second_distribution_fee" label="二次配送费">
                </el-table-column>
                <el-table-column prop="waiting_fee" label="配送专车费">
                </el-table-column>
                <el-table-column prop="airport_pick_fee" label="机场提货费">
                </el-table-column>
                <el-table-column prop="dry_ice_fee" label="干冰费">
                </el-table-column>
                <el-table-column prop="return_box_money" label="返箱费">
                </el-table-column>
                <el-table-column prop="airport_operate_fee" label="机场操作费">
                </el-table-column>
                <el-table-column prop="transfer_fee" label="中转费">
                </el-table-column>
                <el-table-column prop="adjust_reason" label="原因" width="180">
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerType == 4">
              <el-table :data="innerList" style="width: 100%">
                <el-table-column
                  prop="return_receipt_fee"
                  label="回单费用"
                  width="180"
                >
                </el-table-column>
                <el-table-column prop="adjust_reason" label="原因" width="180">
                </el-table-column>
              </el-table>
            </div>
            <div v-if="innerType == 5">
              <el-table :data="innerList" style="width: 100%">
                <el-table-column
                  prop="return_box_fee"
                  label="回箱费用"
                  width="180"
                >
                </el-table-column>
                <el-table-column prop="adjust_reason" label="原因" width="180">
                </el-table-column>
              </el-table>
            </div>
          </el-dialog>
          <!-- </div> -->
          <span slot="footer" class="dialog-footer" style="text-align: center">
            <div>
              <el-button type="primary" @click="derivedDataFoot()"
                >导出</el-button
              >
            </div>
          </span>
        </el-dialog>
      </div>
      <!-- 底部按钮 -->
      <div class="auditProcessbuttom">
        <div style="text-align: center; margin: 5px 0px 5px 0px">
          <div
            v-if="paramsData.TageType == 3 || paramsData.TageType == 4"
            style="text-align: center"
          >
            <el-button type="primary" plain @click="closeprogram()"
              >关闭</el-button
            >

            <el-button
              @click="PassAuditadd(1)"
              type="primary"
              v-if="
                paramsData.TageType == 3 &&
                AuditDetails.is_current_user_can_approve == 1
              "
              plain
              :disabled="false"
              >通过</el-button
            >
            <el-button
              @click="PassAuditadd(2)"
              type="primary"
              v-if="
                paramsData.TageType == 3 &&
                AuditDetails.is_current_user_can_approve == 1
              "
              plain
              :disabled="false"
              >驳回</el-button
            >
            <el-button
            @click="PassAuditturn()"
            type="primary"
            v-if="
              paramsData.TageType == 3 &&
              AuditDetails.is_current_user_can_approve == 1
            "
            plain
            :disabled="false"
            >转办</el-button
          >
            <el-button
              type="primary"
              v-if="
                (formdata.status == 1 || formdata.status == 2) &&
                (localgetdata.user_id == formdata.creator_id ||
                  localgetdata.user_id == 1)
              "
              plain
              @click="auditInvoice()"
              >撤回</el-button
            >
            <el-button
              type="primary"
              v-if="
                formdata.status == 1 ||
                formdata.status == 2 ||
                formdata.status == 3
              "
              plain
              @click="exportData()"
              >导出</el-button
            >
            <el-dropdown style="margin: 0px 0px 0px 10px" >
              <el-button type="primary" plain>
                更多<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown" :append-to-body="false">
                <!-- <el-dropdown-item style="width: 50px; text-align: center;"
                                    v-if="formdata.status == 1 || formdata.status == 2 || formdata.status == 3">
                                    <span @click="exportData()">导出</span>
                                  
                                </el-dropdown-item> -->
                <el-dropdown-item
                  style="width: 70px; text-align: center"
                  v-if="
                    formdata.status == 1 ||
                    formdata.status == 2 ||
                    formdata.status == 3
                  "
                >
                  <div style="width: 70px;" @click="AddComment()">评论</div>
                  <!-- <el-button @click="AddComment()" type="primary"
                                        v-if="formdata.status == 1 || formdata.status == 2 || formdata.status == 3"
                                        plain>评论</el-button> -->
                </el-dropdown-item>
                <el-dropdown-item
                  v-if="
                    formdata.status == 1 &&
                    localgetdata.user_id == formdata.creator_id
                  "
                  style="width: 70px; text-align: center"
                >
                  <div style="width: 70px;" @click="pressab()">催办</div>
                  <!-- <el-button type="primary"
                                        v-if=" formdata.status == 1 && localgetdata.user_id==  formdata.creator_id "
                                        plain @click="pressab()">催办</el-button> -->
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <div v-else>
            <el-button type="primary" plain @click="closeprogram()"
              >关闭</el-button
            >
            <el-button
              type="primary"
              v-if="this.paramsData.Type == 0"
              plain
              @click="preservedata('ruleForm', 0)"
              >保存</el-button
            >
            <el-button
              type="primary"
              v-if="this.paramsData.Type == 0"
              plain
              @click="preservedata('ruleForm', 1)"
              >发起审批</el-button
            >
            <el-button
              type="primary"
              v-if="this.paramsData.Type == 1"
              plain
              @click="preservedataEadit('ruleForm', 0)"
              >保存</el-button
            >
            <el-button
              type="primary"
              v-if="this.paramsData.Type == 1"
              plain
              @click="preservedataEadit('ruleForm', 1)"
              >发起审批</el-button
            >
            <el-button
              @click="PassAuditadd(1)"
              type="primary"
              v-if="AuditDetails.is_current_user_can_approve == 1"
              plain
              :disabled="false"
              >通过</el-button
            >
            <el-button
              @click="PassAuditadd(2)"
              type="primary"
              v-if="AuditDetails.is_current_user_can_approve == 1"
              plain
              :disabled="false"
              >驳回</el-button
            >
            <el-button
            @click="PassAuditturn()"
            type="primary"
            v-if="AuditDetails.is_current_user_can_approve == 1"
            plain
            :disabled="false"
            >转办</el-button
          >
            <el-button
              type="primary"
              v-if="
                (formdata.status == 1 || formdata.status == 2) &&
                (localgetdata.user_id == formdata.creator_id ||
                  localgetdata.user_id == 1)
              "
              plain
              @click="auditInvoice()"
              >撤回</el-button
            >
            <el-button
              type="primary"
              v-if="
                formdata.status == 1 ||
                formdata.status == 2 ||
                formdata.status == 3
              "
              plain
              @click="exportData()"
              >导出</el-button
            >
            <el-dropdown
              style="margin: 0px 0px 0px 10px"
              v-if="paramsData.TageType != 0"
              :append-to-body="false"
            >
              <el-button type="primary" plain>
                更多<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown" :append-to-body="false">
                <!-- <el-dropdown-item
                                    v-if="formdata.status == 1 || formdata.status == 2 || formdata.status == 3"
                                    style="width: 50px;text-align: center;">
                                    <span @click="exportData()">导出 </span>
                                </el-dropdown-item> -->
                <el-dropdown-item
                  v-if="
                    formdata.status == 1 &&
                    localgetdata.user_id == formdata.creator_id
                  "
                  style="width: 70px; text-align: center"
                >
                  <div style="width: 70px;" @click="pressab()">催办</div>

                  <!-- <el-button type="primary"
                                        v-if=" formdata.status == 1 && localgetdata.user_id==  formdata.creator_id " plain
                                        @click="pressab()">催办</el-button> -->
                </el-dropdown-item>
                <el-dropdown-item
                  v-if="
                    formdata.status == 1 ||
                    formdata.status == 2 ||
                    formdata.status == 3
                  "
                  style="width: 70px; text-align: center"
                >
                  <div style="width: 70px;" @click="AddComment()"> 评论</div>

                  <!-- <el-button @click="AddComment()" type="primary"
                                    v-if="formdata.status == 1 || formdata.status == 2 || formdata.status == 3"
                                    plain>评论</el-button> -->
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </div>
      </div>
    </div>
    <!--  -->
    <!-- 调账日志 -->
    <el-dialog
      title="调账日志"
      :visible.sync="dialogVisible_balance"
      width="40%"
    >
      <div v-if="nodeData.length > 0">
        <el-timeline style="padding: 0 20px" :reverse="true">
          <el-timeline-item
            v-for="(activity, index) in nodeData"
            :key="index"
            :timestamp="
              new Date(Number(activity.create_time) * 1000).toLocaleString()
            "
          >
            <span>{{ activity.content }}操作人：{{ activity.creator }}</span>
          </el-timeline-item>
        </el-timeline>
      </div>
      <div v-else>暂无调账</div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible_balance = false">取 消</el-button>
      </span>
    </el-dialog>
       <!-- 转办 -->
       <div v-if="dialogturn">
        <TurnTohold :audit_id_list="audit_id_list" @listenToChildEvent='showMsgfromChild'  :AuditDetails="AuditDetails"></TurnTohold>
      </div>
      <!-- 调账分摊金额 -->
    <div>
      <el-dialog
      width="60%"
      :title="innerTextamount"
      :visible.sync="innerVisibleamount"
      append-to-body
      >
      <div v-if="innerTypeDatalist.length > 0 ">
        <div v-for="(itme,index) in innerTypeDatalist" style="margin: 0px 0px 10px 0px;">
          <el-tag >{{itme}}</el-tag>
         </div>
      </div>
      <div v-else>
        <el-tag >暂无调账分摊金额</el-tag>
      </div>
    </el-dialog>
    </div>
  </div>
</template>
<script>
import {
  reqReceiptBookList,
  reqAuditReceipt, //审核发票
  reqCustomerCheckLog,
} from "@/api/finance";
import { downloadFile } from "@/page/material/common/common";
import TurnTohold from "@/components/TurnTohold/TurnTohold.vue"
import approval from "@/components/approval/approval.vue";
import UploadLink from "@/components/uploadFile/uploadLink.vue";
import quillLink from "@/components/quillLink/quillLink.vue";
import { InvoiceBookoptions, InvoiceBookCreate } from "@/api/information";
import {
  invoice_apply_create,
  invoice_apply_detail,
  invoice_apply_update,
  invoice_apply_export,
  finance_customer_diagnosis_export,
} from "@/api/paymentrequest";
import { timestamp10 } from "@/utils/mUtils"; // 时间转化
import { reqWebsiteList } from "@/api/customer";
import {
  record_process_detail,
  examine_record_update,
  examine_comment_create,
  examine_comment_delete,
  petty_cash_apply_export,
  examine_record_send_message,
  finance_customer_diagnosis,
  finance_customer_diagnosis_detail,
  customer_diagnosis_reason
} from "@/api/paymentrequest";
// import Quill from "quill";
// import mention from "quill-mention"; // 引入mention 组件
// import "quill-mention/dist/quill.mention.min.css";
export default {
  name: "receiptManageadd",
  components: { UploadLink, approval, quillLink, TurnTohold},
  data() {
    // 运输货物
    let validator_transport_goods = (rule, value, callback) => {
      if (this.formdata.invoice_rate == "9" && value == "") {
        callback(new Error("运输货物"));
      } else {
        callback();
      }
    };
    // 运输车牌号
    let validator_vehicle_number = (rule, value, callback) => {
      if (this.formdata.invoice_rate == "9" && value == "") {
        callback(new Error("运输车牌号"));
      } else {
        callback();
      }
    };
    // 车辆型号
    let validator_vehicle_type = (rule, value, callback) => {
      if (this.formdata.invoice_rate == "9" && value == "") {
        callback(new Error("车辆型号"));
      } else {
        callback();
      }
    };
    // 起发地
    let start_place_stop_place = (rule, value, callback) => {
      if (this.formdata.invoice_rate == "9" && value == "") {
        callback(new Error("始发地"));
      } else {
        callback();
      }
    };
    // 目的地
    let end_place_stop_place = (rule, value, callback) => {
      if (this.formdata.invoice_rate == "9" && value == "") {
        callback(new Error("目的地"));
      } else {
        callback();
      }
    };
    return {
      titleTip: "申请开票",
      customer_invoice_book_list: [], //发票簿的下拉列表
      company_invoice_book_list: [], //我方发票主体
      formdata: {
        customer_invoice_book_info: {
          invoice_body_name: "", // 发票主体名
          taxpayer_identify_number: "", // 纳税人识别号
          company_address: "", // 公司地址
          company_phone: "", // 公司电话
          bank_of_deposit: "", // 开户行
          account_no: "", // 开户行账号
        }, // 发票主体信息(客户)

        // ============
        account_id: "", // 对账单id
        customer_invoice_body_id: "", // 客户发票主体
        is_invoiced: "1", // 是否已开具发票 0否 1是
        invoice_type: "", // 发票类型 1专用 2普通
        invoice_amount: "", // 发票金额
        annex: [], // 附件
        invoice_category: "", // 发票类目
        invoice_rate: "0", // 发票税率
        company_invoice_body_id: "", // 我方发票主体
        transport_goods: "", // 运输货物
        vehicle_number: "", // 运输车牌号
        vehicle_type: "", // 车辆型号
        // start_stop_place: "",        // 起止地
        statement_date: "", // 账单日起
        return_time: "", // 预计回款日起
        is_need_send: "0", // 是否需要邮寄 0否 1是
        mailing_address: "", // 邮寄地址
        remark: "", // 备注
        business_type: [], //业务类型
        revenue_branch_id: "", //收入部门
        is_initiate_audi: "0", //是否发起审核 0 否 1 是
        apply_no: "", //对账单号
        start_place: "", //
        end_place: "", //
      },
      rulesdata: {
        customer_invoice_body_id: [
          { required: true, message: "发票主体名称", trigger: "change" },
        ],
        is_invoiced: [
          { required: true, message: "是否开具发票", trigger: "change" },
        ],
        invoice_type: [
          { required: true, message: "发票类型", trigger: "change" },
        ],
        invoice_category: [
          { required: true, message: "请选择发票类目", trigger: "blur" },
        ],
        company_invoice_body_id: [
          { required: true, message: "我方发票主体", trigger: "blur" },
        ],
        transport_goods: [
          { validator: validator_transport_goods, trigger: "blur" },
        ],
        vehicle_number: [
          { validator: validator_vehicle_number, trigger: "blur" },
        ],
        vehicle_type: [{ validator: validator_vehicle_type, trigger: "blur" }],
        // start_stop_place: [

        //     { validator: validator_start_stop_place, trigger: "blur" },
        // ],
        start_place: [{ validator: start_place_stop_place, trigger: "blur" }],
        end_place: [{ validator: end_place_stop_place, trigger: "blur" }],
        return_time: [
          { required: true, message: "预计回款日起", trigger: "change" },
        ],
        is_need_send: [
          { required: true, message: "对账单需要盖章邮寄", trigger: "change" },
        ],
        // 收入部门
        revenue_branch_id: [
          {
            required: true,
            message: "请选择关联渡石发票主体",
            trigger: "blur",
          },
        ], //
      },
      OpeningInvoice: [
        {
          value: "0",
          label: "否",
        },
        {
          value: "1",
          label: "是",
        },
      ],
      // 业务类型
      businessType: [
        {
          value: "0",
          label: "生态业务",
        },
        {
          value: "1",
          label: "保温箱",
        },
        {
          value: "2",
          label: "常温零担",
        },
        {
          value: "3",
          label: "常温整车",
        },
        {
          value: "4",
          label: "冷链零担",
        },
        {
          value: "5",
          label: "冷链整车",
        },
        {
          value: "6",
          label: "干冰运输",
        },
      ],
      // 客户发票主体
      dialogVisible: false,
      formList: {
        invoice_body_name: "", // 发票主体名称
        company_name: "", // 公司名
        taxpayer_identify_number: "", // 纳税人识别号
        company_address: "", // 公司地址
        company_phone: "", // 公司电话
        bank_of_deposit: "", // 开户行
        account_no: "", // 开户行账号
        invoice_body_belong: "", // 发票主体所属：0公司，1客户，2承运商
        belong_to_id: "", // 发票主体所属(公司、客户、承运商)id
        relation_invoice_body_id: [], // 关联公司发票主体id，
      },
      formrules: {
        invoice_body_name: [
          { required: true, message: "请填写发票主体名称", trigger: "blur" },
        ], // 发票主体名称
        company_name: [
          { required: true, message: "请填写公司名", trigger: "blur" },
        ], // 公司名
        taxpayer_identify_number: [
          { required: true, message: "请填写纳税人识别号", trigger: "blur" },
        ], // 纳税人识别号
        company_address: [
          { required: true, message: "请填写公司地址", trigger: "blur" },
        ], // 公司地址
        company_phone: [
          { required: true, message: "请填写公司电话", trigger: "blur" },
        ], // 公司电话
        bank_of_deposit: [
          { required: true, message: "请填写开户行", trigger: "blur" },
        ], // 开户行
        account_no: [
          { required: true, message: "请填写开户行账号", trigger: "blur" },
        ], // 开户行账号
        relation_invoice_body_id: [
          {
            required: true,
            message: "请选择关联渡石发票主体",
            trigger: "blur",
          },
        ], // 关联公司发票主体id，客户和承运商字段
      },
      invoiceType: "", //发票
      // 审批
      AuditDetails: {},
      // 请选择关联渡石发票主体
      formListoptions: [],
      // 申请开票
      paramsData: "",
      // 收入部门
      RevenueSector: [],
      //
      audit_id_list: "",
      auditOpinionVisble: false,
      PassAuditsucced: "",
      opinionFile: {
        opinion: "", //审核意见
        opinion_annex: [],
      },
      commdialogVisible: false,
      fileListList: [],
      recordex: {
        examine_record_id: "", // 审核记录id
        content: "", // 内容
        annex: [],
      },
      disabledType: false,
      localgetdata: "",
      // 评论@功能催办
      contentList: {},
      outerVisible: false,
      outerVisibleList: [],
      // 诊断
      diagnosedatalog: false,
      innerVisible: false,
      diagnoseListe: [], // 诊断列表
      innerText: "",
      innerList: [],
      updatedData: [], //总运费
      tableHeight: "", //高度
      dialogVisible_balance: false,
      nodeData: [],
      innerType: "",
      dialogturn:false,
      innerTextamount:"调账分摊金额",
      innerVisibleamount:false,
      innerTypeamount:"",
      innerTypeDatalist:[]
    };
  },
  filters: {
    afterTime(value) {
      switch (value) {
        case "0":
          return "未对账";
        case "1":
          return "部分对账";
        case "2":
          return "已对账";
      }
    },
  },
  mounted() {
    this.localgetdata = JSON.parse(localStorage.getItem("user"));

    // 发票主体的下拉
    // this.InvoiceBookbodyFn()
    this.paramsData = this.$route.query;
    // 发票申请
    this.reqReceiptBookListData();
    // 所属组织
    this.reqWebsiteListData();
    if (this.paramsData) {
      this.formdata.account_id = this.paramsData.id;
      this.formdata.invoice_amount = this.paramsData.now_price;
      this.formList.belong_to_id = this.paramsData.account_customer_id;
      this.audit_id_list = this.paramsData.audit_id;
    }
    if (this.paramsData.Type == 1) {
      this.invoice_apply_detailObj();
    } else if (this.paramsData.Type == 2) {
      this.disabledType = true;
      this.invoice_apply_detailObj();
    } else if (this.paramsData.Type == 0) {
      this.formdata.apply_no = this.paramsData.account_no;
      this.formdata.revenue_branch_id = this.localgetdata.branch_id + "";
      this.formdata.customer_id_name = this.paramsData.customer_name;
    }
    if (this.paramsData.TageType == 3) {
      this.audit_id_list = this.paramsData.audit_id;
      this.record_process_detailObj();
    } else {
    }
    // // 发票申请
    this.reqReceiptBookListData();
    // 所属组织
    this.reqWebsiteListData();
  },
  methods: {
    // 详情
    invoice_apply_detailObj() {
      var param = {
        id: this.paramsData.id,
      };
      invoice_apply_detail(param).then((res) => {
        this.formdata = res.data;
        this.paramsData.account_customer_id = this.formdata.customer_id; // 赋值
        this.formdata.customer_invoice_body_id =
          res.data.customer_invoice_body_id + "";
        this.selectedWebsite(res.data.customer_invoice_body_id);
        this.formdata.return_time =
          res.data.return_time != 0 ? res.data.return_time * 1000 : "";
        this.formdata.company_invoice_body_id =
          res.data.company_invoice_body_id + "";
        this.formdata.revenue_branch_id =
          res.data.revenue_branch_id == 0
            ? ""
            : res.data.revenue_branch_id + "";
            // res.data.examine_id > 0
        if (res.data.status != 0) {
          this.audit_id_list = res.data.examine_id;
          this.record_process_detailObj();
        }
      });
    },

    reqWebsiteListData() {
      var param = {
        branch_type: "3",
        name: "",
      };
      reqWebsiteList(param).then((res) => {
        this.RevenueSector = res.data;
      });
    },
    reqReceiptBookListData() {
      var param = {
        body_belong: "1", //请求发票主体客户下拉用这个
        belong_to_id: this.paramsData.account_customer_id * 1, //对账单上的客户id
        invoice_body_name: "", //发票主体名
      };
      reqReceiptBookList(param).then((res) => {
        if (res.code == 10000) {
          this.customer_invoice_book_list = res.data;
        }
      });
      var param = {
        body_belong: "0", //请求我方发票主体公司
      };
      reqReceiptBookList(param).then((res) => {
        if (res.code == 10000) {
          this.company_invoice_book_list = res.data;
        }
      });
    },
    // 发票类型
    selectCategory(val) {
      //看看动态表单验证升不生效
      if (val === "1") {
        this.formdata.invoice_rate = "9";
      } else {
        this.formdata.invoice_rate = "6";
      }
    },
    // 创建发票主体
    AddInvoice(val) {
      this.invoiceType = val;
      this.dialogVisible = true;
      this.InvoiceBookbodyFn();
    },
    // 创建客户发票主体
    establish(formList) {
      this.$refs[formList].validate((valid) => {
        if (valid) {
          var param = {
            ...this.formList,
            type: 0 + "", //0 是其他 1 是备用金
            invoice_body_belong: this.invoiceType + "", //发票
            belong_to_id: this.paramsData.account_customer_id * 1,
          };
          InvoiceBookCreate(param).then((res) => {
            if (res.code == "10000") {
              this.dialogVisible = false;
              Object.assign(this.$data.formList, this.$options.data().formList);
              location.reload();
            }
          });
        }
      });
    },
    dialogVisibleflase() {
      this.dialogVisible = false;
      Object.assign(this.$data.formList, this.$options.data().formList);
    },
    open1(typedata, megessdata) {
      this.$message({
        message: megessdata,
        type: typedata,
      });
    },
    //
    // 获取发票主体的下拉
    InvoiceBookbodyFn() {
      var param = {
        body_belong: 0 + "", // 发票主体所属：0公司，1客户，2承运商
        belong_to_id: 0, // 发票主体所属id
        invoice_body_name: "", // 发票主体名
        type: "0",
      };
      InvoiceBookoptions(param).then((res) => {
        if (res.code == "10000") {
          this.formListoptions = res.data;
        }
      });
    },
    // 关闭
    closeprogram() {
      // this.$router.push({
      //     name: "receiptManage",
      //     query: { TageType: this.paramsData.TageType}
      // })
      this.$router.push({
        name: "receiptManage",
        query: { TageType: this.paramsData.TageType },
      });
      // window.history.back();
      Object.assign(this.$data.formdata, this.$options.data().formdata);
    },
    // 保存 当type 是0 是保存 1 是发起审批
    preservedata(formName, type) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = {
            ...this.formdata,
            company_invoice_body_id: this.formdata.company_invoice_body_id + "",
            is_initiate_audi: type + "",
            return_time:
              this.formdata.return_time == ""
                ? ""
                : this.formdata.return_time / 1000 + "",
            // is_initiate_audi: this.formdata.is_initiate_audi + ""
          };
          invoice_apply_create(param).then((res) => {
            if ((res.code = 10000)) {
              this.open1("申请开票成功", "success");
              this.closeprogram();
            }
          });
        } else {
          return false;
        }
      });
    },

    // 编辑
    preservedataEadit(formName, type) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = {
            ...this.formdata,
            company_invoice_body_id: this.formdata.company_invoice_body_id + "",
            is_initiate_audi: type + "",
            return_time:
              this.formdata.return_time == ""
                ? ""
                : this.formdata.return_time / 1000 + "",
            // is_initiate_audi: this.formdata.is_initiate_audi + ""
          };
          invoice_apply_update(param).then((res) => {
            if ((res.code = 10000)) {
              this.open1("编辑申请开票成功", "success");
              this.closeprogram();
            }
          });
        } else {
          return false;
        }
      });
    },
    // 渡石的账户管理
    selectedWebsite(val) {
      // console.log(val, "+====================")
      if (val) {
        let piece = this.customer_invoice_book_list.find(
          (item) => item.id == val
        );
        this.formdata.customer_invoice_book_info = { ...piece };
        if (piece) {
          var new_data = this.company_invoice_book_list.filter((item) =>
            piece.relation_invoice_body_id.includes(item.id.toString())
          );
          this.company_invoice_book_list = new_data;
        }
      }
    },
    //
    open1(value, type) {
      this.$message({
        message: value,
        type: type,
      });
    },
    // 审核流程
    record_process_detailObj() {
      var param = {
        id: this.audit_id_list + "",
      };
      record_process_detail(param).then((res) => {
        this.AuditDetails = res.data || {};
      });
    },
    // 审核通过
    PassAuditadd(value) {
      this.auditOpinionVisble = true;
      this.PassAuditsucced = value;
    },
    // 审核取消
    PassAuditcancel() {
      this.auditOpinionVisble = false;
      Object.assign(this.$data.opinionFile, this.$options.data().opinionFile);
    },
    // 审核通过
    PassAudit() {
      var param = {
        id: this.audit_id_list + "", // 审核记录id
        status: "1", // 是否通过1通过 2打回
        ...this.opinionFile,
      };
      examine_record_update(param).then((res) => {
        if (res.code == "10000") {
          this.open1("审核通过成功", "success");
          this.fileListList = [];
          Object.assign(
            this.$data.opinionFile,
            this.$options.data().opinionFile
          );
          this.auditOpinionVisble = false;
          this.record_process_detailObj();
          this.$router.go(-1);
        }
      });
    },
    // 审核驳回
    ReviewAudit() {
      var param = {
        id: this.audit_id_list + "", // 审核记录id
        status: "2", // 是否通过1通过 2打回
        ...this.opinionFile,
      };
      examine_record_update(param).then((res) => {
        if (res.code == "10000") {
          this.open1("审核驳回", "success");
          this.fileListList = [];
          Object.assign(
            this.$data.opinionFile,
            this.$options.data().opinionFile
          );
          this.auditOpinionVisble = false;
          this.record_process_detailObj();
          this.$router.go(-1);
        }
      });
    },
    // 上传文件
    handleChange(file, fileList, type) {
      this.fileListList = fileList;
      var filelist = file.raw; //文件
      var filename = file.raw.uid + file.raw.name; //通过 uid和name组成文件的名字
      uploading(filelist, filename, type).then((res) => {
        this.opinionFile.opinion_annex.push({
          name: file.uid + "",
          url: res.res.requestUrls[0],
        });
      });
    },
    removeChange(file) {
      const index = this.opinionFile.opinionFile.findIndex(
        (item) => item.uid === file.uid
      );
      index > -1 && this.opinionFile.opinionFile.splice(index, 1);
    },
    //   添加评论
    AddComment() {
      this.commdialogVisible = true;
    },
    updateCity(value) {
      this.contentList = value;
    },
    // 保存评论
    preserveComment() {
      this.$refs.quilldata.preserveComment();
      var param = {
        ...this.recordex,
        content: this.contentList.content,
        examine_record_id: this.audit_id_list + "",
      };
      examine_comment_create(param).then((res) => {
        if (res.code == "10000") {
          this.open1("添加评论成功", "success");
          this.record_process_detailObj();
          this.commdialogVisible = false;
          Object.assign(this.$data.recordex, this.$options.data().recordex);
          this.$refs.quilldata.preserveCommentclear();
        }
      });
      var param = {
        examine_id: this.audit_id_list + "",
        receiver_ids: this.contentList.receiver_ids, // 数组int类型的用户id
        content: this.contentList.content, // 评论内容，  催办不用填
        type: "0", // 0评论 1催办
      };
      examine_record_send_message(param).then((res) => {
        this.record_process_detailObj();
        this.commdialogVisible = false;
      });
    },
    // 删除评论
    deletComment(val) {
      var param = {
        id: val.id,
      };
      examine_comment_delete(param).then((res) => {
        this.open1("删除评论成功", "success");
        this.record_process_detailObj();
      });
    },
    fatherMethod() {
      this.record_process_detailObj();
    },
    exportData() {
      // console.log("导出按钮案件")
      var param = {
        id: this.paramsData.id,
      };
      invoice_apply_export(param).then((res) => {
        if (res.code == 10000) {
          downloadFile(res.data.loaded_url);
          // window.open(res.data.loaded_url);
          this.$message({
            type: "success",
            message: "导出成功",
          });
        }
      });
    },
    auditInvoice() {
      //审核通过
      var param = {
        id: this.formdata.id,
      };
      reqAuditReceipt(param).then((res) => {
        if (res.code == 10000) {
          this.$router.push({
            name: "receiptManage",
          });
        }
      });
    },
    StatementNumber() {
      if (this.paramsData.Type == 0) {
        this.$router.push({
          name: "shippingcustomer",
          query: { id: this.formdata.account_id, dataPage: 1 },
        });
      } else {
        this.$router.push({
          name: "shippingcustomer",
          query: { id: this.formdata.account_id, dataPage: 1 },
        });
      }
    },
    //
    pressab() {
      this.outerVisible = true;
    },
    outerVisibleconfirm() {
      var param = {
        examine_id: this.audit_id_list + "",
        receiver_ids: this.outerVisibleList.map(Number), // 数组int类型的用户id
        content: "", // 评论内容，  催办不用填
        type: "1", // 0评论 1催办
      };
      examine_record_send_message(param).then((res) => {
        this.record_process_detailObj();
        this.outerVisible = false;
      });
    },
    // 【诊断】
    diagnose() {
      this.diagnosedatalog = true;
      var param = {
        account_id: this.formdata.account_id,
        apply_id: this.formdata.id,
      };
      finance_customer_diagnosis(param).then((res) => {
        this.diagnoseListe = res.data || [];
        if (this.diagnoseListe.length > 5) {
          this.tableHeight = "450px";
        } else {
          this.tableHeight = "";
        }
      });
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = {};
      columns.forEach((column) => {
        sums[column.property] = 0;
      });
      var all_margin = 0;
      var all_freight = 0;
      var ctotal_expense_data = 0;
      var ctotal_freight_data = 0;
      var total_expense_data_all = 0;
      var gross_profit_data_all = 0;
      var dtotal_expense_data = 0;
      var bution_expense_data = 0;
      var box_expense_data = 0;
      var rec_expense_data = 0;
      data.forEach((item) => {
        columns.forEach((column, index) => {
          if (column.property in sums) {
            if (column.property === "collect_info.total_expense") {
              // sums[column.property] += this.checkAndParseValue(item.collect_info.total_expense);
              ctotal_expense_data += this.checkAndParseValue(
                item.collect_info.total_expense
              );
              sums[column.property] = ctotal_expense_data.toFixed(2);
            } else if (column.property === "total_freight") {
              // sums[column.property] += parseFloat(item.total_freight);
              ctotal_freight_data += parseFloat(item.total_freight);
              sums[column.property] = ctotal_freight_data.toFixed(2);
            } else if (column.property === "gross_margin") {
              all_margin += parseFloat(item.gross_profit);
              all_freight += parseFloat(item.total_freight);
              if (all_margin && all_freight) {
                sums[column.property] =
                  ((all_margin / all_freight) * 100).toFixed(2) + "%";
              }
            } else if (column.property === "total_expense") {
              // sums[column.property] += parseFloat(item.total_expense);
              total_expense_data_all += parseFloat(item.total_expense);
              sums[column.property] = total_expense_data_all.toFixed(2);
            } else if (column.property === "gross_profit") {
              // sums[column.property] += parseFloat(item.gross_profit);
              gross_profit_data_all += parseFloat(item.gross_profit);
              sums[column.property] = gross_profit_data_all.toFixed(2);
            } else if (column.property === "dispatch_info.total_expense") {
              // sums[column.property] += this.checkAndParseValue(item.dispatch_info.total_expense);
              dtotal_expense_data += this.checkAndParseValue(
                item.dispatch_info.total_expense
              );
              sums[column.property] = dtotal_expense_data.toFixed(2);
            } else if (column.property === "distribution_info.total_expense") {
              // sums[column.property] += this.checkAndParseValue(item.distribution_info.total_expense);
              bution_expense_data += this.checkAndParseValue(
                item.distribution_info.total_expense
              );
              sums[column.property] = bution_expense_data.toFixed(2);
            } else if (column.property === "box_recycle_info.total_expense") {
              // sums[column.property] += this.checkAndParseValue(item.box_recycle_info.total_expense);
              box_expense_data += this.checkAndParseValue(
                item.box_recycle_info.total_expense
              );
              sums[column.property] = box_expense_data.toFixed(2);
            } else if (column.property === "receipt_info.total_expense") {
              // sums[column.property] += this.checkAndParseValue(item.receipt_info.total_expense);
              rec_expense_data += this.checkAndParseValue(
                item.receipt_info.total_expense
              );
              sums[column.property] = rec_expense_data.toFixed(2);
            } else {
              sums[column.property] = "";
            }
          } else {
          }
          // if (index === 0) {
          //     sums[index] = '汇总';
          // }
        });
      });
      sums["waybill_no"] = "汇总";
      return Object.keys(sums).map((key) => {
        return sums[key];
      });
    },
    checkAndParseValue(value) {
      const parsedValue = parseFloat(value);
      return isNaN(parsedValue) ? 0 : parsedValue;
    },
    wayClick(value) {
      var id = value.waybill_id;
      let text = this.$router.resolve({
        name: "waybillDetail",
        query: { id, activeName: "1" },
      });
      window.open(text.href, "_blank");
    },
    freightclick(value, text, type) {
      // type 1揽收 2干线 3配送 4回单 5回箱
      this.innerVisible = true;
      this.innerText = text;
      this.innerType = type;
      var param = {
        waybill_id: value.waybill_id,
        node_type: type + "", // 1揽收 2干线 3配送 4回单 5回箱
      };
      finance_customer_diagnosis_detail(param).then((res) => {
        if (type != 0) {
          this.innerList = res.data;
        } else {
          this.updatedData = res.data.map((item) => {
            this.expense_list = {
              key_1: item["1"] == undefined ? 0 : item["1"],
              key_4: item["4"] == undefined ? 0 : item["4"],
              key_5: item["5"] == undefined ? 0 : item["5"],
              key_6: item["6"] == undefined ? 0 : item["6"],
              key_8: item["8"] == undefined ? 0 : item["8"],
              key_9: item["9"] == undefined ? 0 : item["9"],
              key_10: item["10"] == undefined ? 0 : item["10"],
              adjust_reason:item.adjust_reason
            };
            return {
              ...this.expense_list,
            };
          });
        }
      });
    },
    AssessedAmount(value, text, type) {
         // type 1揽收 2干线 3配送 4回单 5回箱
      this.innerVisibleamount = true;
      this.innerTextamount = text;
      this.innerTypeamount = type;
      var param = {
        waybill_id: value.waybill_id,
        node_type: type + "", // 1揽收 2干线 3配送 4回单 5回箱
      };
      customer_diagnosis_reason(param).then((res) => {
        this.innerTypeDatalist = res.data
        console.log(res,"resdfads")
      })
    },
    derivedDataFoot() {
      var param = {
        account_id: this.formdata.account_id,
        apply_id: this.formdata.id,
      };
      finance_customer_diagnosis_export(param).then((res) => {
        this.reqUrl = "https://" + res.data.loaded_url;
        window.open(this.reqUrl);
      });
    },
    //函数
    parseGrossMargin(grossMarginStr) {
      if (grossMarginStr && grossMarginStr.endsWith("%")) {
        const numericValue = parseFloat(grossMarginStr.replace("%", ""));
        return isNaN(numericValue) ? 0 : numericValue / 100;
      }
      return 0;
    },
    //调账差额
    AdjustmentBalance() {
      this.dialogVisible_balance = true;
      // console.log(this.formdata)
      var param = {
        account_id: this.formdata.account_id,
      };
      reqCustomerCheckLog(param).then((res) => {
        // console.log(res, "resfadsfasdf")
        this.nodeData = res.data;
      });
    },
    PassAuditturn() {
        this.dialogturn = true
      },
      showMsgfromChild(data) {
        console.log(data, " this.$emit('listenToChildEvent',this.datalist)")

        if (data.resstatus == 1) {
          this.record_process_detailObj()
          this.$router.go(-1);
        } else {

        }
        this.dialogturn = false
      }
  },
};
</script>
<style scoped lang="less">
/deep/ .el-upload--picture-card,
/deep/ .uploadList .el-upload-list__item {
  width: 98px;
  height: 98px;
  line-height: 100px;
}

.row_height_of {
  height: 80px;
}
/deep/ .receiptManageadd_form_details .el-form-item--mini .el-form-item__label {
  line-height: 6px;
  /* font-weight: bold; */
}
.receiptManageadd_form_details .row_height_of {
  /* height: 70px; */
   /* display: none; */
   height: initial;
   /* font-weight: bold; */
   font-size: 15px;
   /* margin-bottom:20px ; */
}
/deep/ .receiptManageadd_form_details .el-form-item__content  {
   font-weight: bold;
 }
/deep/ .el-dropdown-menu--mini .el-dropdown-menu__item {
  padding: 0px;
 }
.paymentReqAdd_head {
  padding: 20px;
  background-color: #fff;
  border-radius: 10px;
  margin: 10px 10px 10px 10px;
}

.auditProcessbuttom {
  position: fixed;
  background: #ffffff;
  margin: 10px 10px 10px 10px;
  padding: 10px;
  border-radius: 10px;
  width: calc(100% - 225px);
  z-index: 100;
  bottom: -1.5%;
}

.rule_title {
  display: flex;
  align-items: center;
  padding-bottom: 18px;
  padding-top: 8px;
  font-size: 14px;
  font-weight: bold;
  justify-content: space-between;

  .title-l {
    display: flex;
    align-items: center;
  }

  .icon_left {
    display: inline-block;
    width: 6px;
    height: 16px;
    background: #f1a357;
    margin-right: 6px;
  }
}
</style>